//
//  MyBranchThreeTableViewCell.m
//  ShangHaiHuDongApp
//
//  Created by 刘应平 on 2017/6/14.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "MyBranchThreeTableViewCell.h"

@interface MyBranchThreeTableViewCell ()
/**    */
@property (strong, nonatomic) UIImageView  *lpImageView;
/**  type  */
@property (strong, nonatomic) UILabel  *type;
/**  time  */
@property (strong, nonatomic) UILabel  *time;
/**  content  */
@property (strong, nonatomic) UILabel  *content;



@end
@implementation MyBranchThreeTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

/**  70  */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self addSubview:self.lpImageView];
        [self addSubview:self.type];
        [self addSubview:self.content];
        //        [self addSubview:self.time];
        
        self.lpImageView.sd_layout.topSpaceToView(self, 12 * [UIScreen zj_screenHScale])
        .leftSpaceToView(self, 18 * [UIScreen zj_screenWScale])
        .heightIs(22 * [UIScreen zj_screenHScale])
        .widthIs(22 * [UIScreen zj_screenHScale]);
        
        self.type.sd_layout.leftSpaceToView(self.lpImageView, 10 * [UIScreen zj_screenWScale])
        .topSpaceToView(self, 17 * [UIScreen zj_screenHScale])
        .heightIs(12 * [UIScreen zj_screenHScale])
        .widthIs([UIScreen zj_screenWith] - 70 * [UIScreen zj_screenWScale]);
        
        self.time.sd_layout.rightSpaceToView(self, 15 * [UIScreen zj_screenWScale])
        .topEqualToView(self.type)
        .heightIs(12 * [UIScreen zj_screenHScale])
        .widthIs(200);
        
        
        TenGrayShadowView *five = [TenGrayShadowView new];
        five.backgroundColor = [UIColor themeGrayColor];
        [self addSubview:five];
        five.sd_layout.bottomEqualToView(self)
        .leftEqualToView(self)
        .rightEqualToView(self)
        .heightIs(5 * [UIScreen zj_screenHScale]);
    }
    return self;
}

- (void)setModel:(ActivityJoinDetailModel *)model{
    _model = model;
    self.lpImageView.image = [UIImage imageNamed:@"list_tixing"];
    self.type.text = model.ACT_CLASS_NAME;
    
    
    //     CGFloat height =  [CalculateLabelHeight calculateLabeHeightWithString:model.DESCRIPTION font:15 * [UIScreen zj_textFontScale] width:[UIScreen zj_screenWith] - 80 * [UIScreen zj_screenWScale] space:4 * [UIScreen zj_screenHScale]];
    self.content.attributedText = [UILabel setSpaceForLineWithText:model.partyOpenJoinString lineSpace:5 * [UIScreen zj_screenHScale]];
    //    CGFloat contentHeight;
    //    if (height > 20 * [UIScreen zj_screenHScale]) {
    //        contentHeight = height;
    //    }else{
    //        contentHeight = 20 * [UIScreen zj_screenHScale];
    //    }
    self.content.sd_layout.topSpaceToView(self.type, 10 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.type)
    .heightIs(model.partyOpenCellHeight - 55 * [UIScreen zj_screenHScale])
    .widthIs([UIScreen zj_screenWith] - 90 * [UIScreen zj_screenWScale]);
    
    
}
- (UIImageView *)lpImageView{
    if (!_lpImageView) {
        _lpImageView = [UIImageView new];
        _lpImageView.contentMode = UIViewContentModeCenter;
        
    }
    return _lpImageView;
}

- (UILabel *)type{
    if (!_type) {
        _type = [UILabel new];
        _type.textColor = [UIColor grayColor];
        _type.font = LYPFONT(16);
    }
    return _type;
}

- (UILabel *)content{
    if (!_content) {
        _content = [UILabel new];
        _content.textColor = [UIColor textGrayColor];
        _content.font = LYPFONT(15);
        _content.numberOfLines = 0;
    }
    return _content;
}

- (UILabel *)time{
    if (!_time) {
        _time = [UILabel new];
        _time.textAlignment = NSTextAlignmentRight;
        _time.textColor = [UIColor lightGrayColor];
        _time.font = LYPFONT(15);
    }
    return _time;
}
@end
